<%@ page import="com.mg.service.UserService" %>
<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="com.mg.model.User" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="../../common/taglibs.jsp" %>
<%@ include file="../../common/head.builive.inc.jsp" %>
<%@ include file="../../common/session.script.inc.jsp" %>
<%
    WebApplicationContext context = (WebApplicationContext) request.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    UserService userService = (UserService) context.getBean("userServiceImpl");
    User user = (User) request.getSession().getAttribute(Constants.USER_INFO);
    user = userService.getUser(user.getId());
%>
<html>
<head>
    <title>修改收益类型</title>
</head>

<style>
    div {
        font-size: 16px;
    }

    .revenueTypeDiv {
        width: 600px;
        margin-left: auto;
        margin-top: 100px;
        margin-right: auto;
    }

    .revenueType input {
        margin: 0;
        padding: 0;
        margin-top: -2px;
        margin-bottom: 1px;
        vertical-align: middle;
    }

    .revenueType p {
        margin-top: 10px;
    }
    .saveBtn{
        font-size: 16px;
    }
</style>
<div class="revenueTypeDiv panel">
    <div class="panel-body">
        <label class="control-label"><b>收益类型：</b></label>
        <div class="revenueType">
            <p><input type="radio" name="revenueType" value="M"/>现金收益</p>
            <p><input type="radio" name="revenueType" value="E"/>ETH收益</p>
        </div>
        <div>
            <label style="font-size: 20px;color:red">说明:</label>
            选择收益类型为ETH,每天的电费会自动从余额中扣除，如果余额不足以支付电费，则会产生电费欠款。当有电费欠费时，无法使用提现功能，必须充值余额抵扣清除电费欠款。
            电费欠费每个自然月底需结清，否则下个月1号会自动把收益类型切换到人民币结算，结清欠费后方可继续选择ETH结算。
        </div>
        <div>
            <button type="button" class="button button-success saveBtn" style="margin-top: 10px">保存
            </button>
        </div>
    </div>
</div>
</div>
<
<script type="text/javascript">
    $("input:radio[name=revenueType][value= <%=user.getRevenueType()%>]").attr("checked", true);

    $(".saveBtn").on("click", function () {
        var revenueType= $("input[name='revenueType']:checked").val();

        CommonClass.AjaxAction( ctx + "/user/user/saveUser", {revenueType:revenueType}, function (data) {
            if (data.success) {
                Message.show("保存成功", "info", 2000);
            } else {
                Message.show(data.msg, "error", 2000);
            }
        });

    })
</script>
</html>